Component({
  properties: {
    imgSrc: {
      type: String,
      value: ''
    }
  },

  data: {
    height: 0,
    errShow: false
  },

  methods: {
    load(e) {
      let {
        width,
        height
      } = e.detail;
      this.setData({
        height: 340 * height / width
      });
    },

    error(e) {
      this.setData({
        height: 340,
        errShow: true
      });
    }
  }
})